package main.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import univers.Univers;

public class BoardGui extends javax.swing.JFrame {
    Color defaultcolor = new Color(238, 238, 238);
    Color vert = new java.awt.Color(50, 200, 0);

    public BoardGui(Univers U) {
        initComponents();
        new Board(U);
        mainpanel.setSize(320, 320);
        cmdpanel.setSize(200, 100);
        mainpanel.add(Board.ChessBoardPanel);
        getContentPane().add(mainpanel, BorderLayout.WEST);
        getContentPane().add(estpanel, BorderLayout.EAST);
        getContentPane().add(cmdpanel, BorderLayout.SOUTH);
    }

    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainpanel = new javax.swing.JPanel();
        cmdpanel = new javax.swing.JPanel();
        estpanel = new javax.swing.JPanel();
        scrollpanel = new javax.swing.JScrollPane();
        info = new javax.swing.JTextArea();
        quit = new javax.swing.JButton();
        coordY = new javax.swing.JPanel();
        ouestchessboardpanel = new javax.swing.JPanel();
        rg1 = new javax.swing.JLabel();
        rg7 = new javax.swing.JLabel();
        rg8 = new javax.swing.JLabel();
        rg6 = new javax.swing.JLabel();
        rg5 = new javax.swing.JLabel();
        rg4 = new javax.swing.JLabel();
        rg3 = new javax.swing.JLabel();
        rg2 = new javax.swing.JLabel();
        coordX = new javax.swing.JPanel();
        sudchessboardpanel = new javax.swing.JPanel();
        a = new javax.swing.JLabel();
        h = new javax.swing.JLabel();
        b = new javax.swing.JLabel();
        c = new javax.swing.JLabel();
        d = new javax.swing.JLabel();
        e = new javax.swing.JLabel();
        f = new javax.swing.JLabel();
        g = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Les Echecs");
        setName("ihmframe"); // NOI18N

        mainpanel.setMinimumSize(new java.awt.Dimension(320, 320));

        javax.swing.GroupLayout mainpanelLayout = new javax.swing.GroupLayout(mainpanel);
        mainpanel.setLayout(mainpanelLayout);
        mainpanelLayout.setHorizontalGroup(
            mainpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 320, Short.MAX_VALUE)
        );
        mainpanelLayout.setVerticalGroup(
            mainpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 320, Short.MAX_VALUE)
        );

        cmdpanel.setPreferredSize(new java.awt.Dimension(320, 80));

        javax.swing.GroupLayout cmdpanelLayout = new javax.swing.GroupLayout(cmdpanel);
        cmdpanel.setLayout(cmdpanelLayout);
        cmdpanelLayout.setHorizontalGroup(
            cmdpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 350, Short.MAX_VALUE)
        );
        cmdpanelLayout.setVerticalGroup(
            cmdpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 93, Short.MAX_VALUE)
        );

        estpanel.setPreferredSize(new java.awt.Dimension(100, 680));

        scrollpanel.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        scrollpanel.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        scrollpanel.setWheelScrollingEnabled(false);

        info.setColumns(6);
        info.setRows(50);
        scrollpanel.setViewportView(info);

        quit.setText("Quit");
        quit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                quitAction(evt);
            }
        });

        javax.swing.GroupLayout estpanelLayout = new javax.swing.GroupLayout(estpanel);
        estpanel.setLayout(estpanelLayout);
        estpanelLayout.setHorizontalGroup(
            estpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(estpanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(estpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(scrollpanel, javax.swing.GroupLayout.DEFAULT_SIZE, 197, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, estpanelLayout.createSequentialGroup()
                        .addComponent(quit, javax.swing.GroupLayout.PREFERRED_SIZE, 77, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18))))
        );
        estpanelLayout.setVerticalGroup(
            estpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, estpanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(quit)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
                .addComponent(scrollpanel, javax.swing.GroupLayout.PREFERRED_SIZE, 390, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        coordY.setLayout(new java.awt.BorderLayout());

        ouestchessboardpanel.setMaximumSize(new java.awt.Dimension(40, 400));
        ouestchessboardpanel.setPreferredSize(new java.awt.Dimension(40, 320));
        ouestchessboardpanel.setLayout(new java.awt.GridLayout(8, 1));

        rg1.setFont(new java.awt.Font("Arial", 1, 14));
        rg1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        rg1.setText("8");
        rg1.setAlignmentY(20);
        ouestchessboardpanel.add(rg1);

        rg7.setFont(new java.awt.Font("Arial", 1, 14));
        rg7.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        rg7.setText("7");
        rg7.setAlignmentY(20);
        ouestchessboardpanel.add(rg7);

        rg8.setFont(new java.awt.Font("Arial", 1, 14));
        rg8.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        rg8.setText("6");
        rg8.setAlignmentY(20);
        ouestchessboardpanel.add(rg8);

        rg6.setFont(new java.awt.Font("Arial", 1, 14));
        rg6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        rg6.setText("5");
        rg6.setAlignmentY(20);
        ouestchessboardpanel.add(rg6);

        rg5.setFont(new java.awt.Font("Arial", 1, 14));
        rg5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        rg5.setText("4");
        rg5.setAlignmentY(20);
        ouestchessboardpanel.add(rg5);

        rg4.setFont(new java.awt.Font("Arial", 1, 14));
        rg4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        rg4.setText("3");
        rg4.setAlignmentY(20);
        ouestchessboardpanel.add(rg4);

        rg3.setFont(new java.awt.Font("Arial", 1, 14));
        rg3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        rg3.setText("2");
        rg3.setAlignmentY(20);
        ouestchessboardpanel.add(rg3);

        rg2.setFont(new java.awt.Font("Arial", 1, 14));
        rg2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        rg2.setText("1");
        rg2.setAlignmentY(20);
        ouestchessboardpanel.add(rg2);

        coordY.add(ouestchessboardpanel, java.awt.BorderLayout.CENTER);

        coordX.setLayout(new java.awt.BorderLayout());

        sudchessboardpanel.setPreferredSize(new java.awt.Dimension(400, 40));

        a.setFont(new java.awt.Font("Arial", 1, 14));
        a.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        a.setText("a");
        a.setAlignmentY(0.0F);

        h.setFont(new java.awt.Font("Arial", 1, 14));
        h.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        h.setText("b");
        h.setAlignmentY(0.0F);

        b.setFont(new java.awt.Font("Arial", 1, 14));
        b.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        b.setText("c");
        b.setAlignmentY(0.0F);

        c.setFont(new java.awt.Font("Arial", 1, 14));
        c.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        c.setText("d");
        c.setAlignmentY(0.0F);

        d.setFont(new java.awt.Font("Arial", 1, 14));
        d.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        d.setText("e");
        d.setAlignmentY(0.0F);

        e.setFont(new java.awt.Font("Arial", 1, 14));
        e.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        e.setText("f");
        e.setAlignmentY(0.0F);

        f.setFont(new java.awt.Font("Arial", 1, 14));
        f.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        f.setText("g");
        f.setAlignmentY(0.0F);

        g.setFont(new java.awt.Font("Arial", 1, 14));
        g.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        g.setText("h");
        g.setAlignmentY(0.0F);

        javax.swing.GroupLayout sudchessboardpanelLayout = new javax.swing.GroupLayout(sudchessboardpanel);
        sudchessboardpanel.setLayout(sudchessboardpanelLayout);
        sudchessboardpanelLayout.setHorizontalGroup(
            sudchessboardpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sudchessboardpanelLayout.createSequentialGroup()
                .addGap(50, 50, 50)
                .addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(h, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(12, 12, 12)
                .addComponent(b, javax.swing.GroupLayout.PREFERRED_SIZE, 26, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(12, 12, 12)
                .addComponent(c, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(d, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(e, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(f, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(g, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(89, 89, 89))
        );
        sudchessboardpanelLayout.setVerticalGroup(
            sudchessboardpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(sudchessboardpanelLayout.createSequentialGroup()
                .addGroup(sudchessboardpanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(a, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(h, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(b, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(c, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(d, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(e, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(f, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(g, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        coordX.add(sudchessboardpanel, java.awt.BorderLayout.SOUTH);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(cmdpanel, javax.swing.GroupLayout.DEFAULT_SIZE, 350, Short.MAX_VALUE))
                    .addComponent(coordX, 0, 0, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(coordY, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(mainpanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(21, 21, 21)
                .addComponent(estpanel, javax.swing.GroupLayout.PREFERRED_SIZE, 207, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(estpanel, javax.swing.GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(mainpanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(coordY, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(coordX, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(cmdpanel, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );

        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width-606)/2, (screenSize.height-519)/2, 606, 519);
    }// </editor-fold>//GEN-END:initComponents
    private void quitAction(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_quitAction
        this.dispose();
}//GEN-LAST:event_quitAction

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel a;
    private javax.swing.JLabel b;
    private javax.swing.JLabel c;
    private javax.swing.JPanel cmdpanel;
    private javax.swing.JPanel coordX;
    private javax.swing.JPanel coordY;
    private javax.swing.JLabel d;
    private javax.swing.JLabel e;
    private javax.swing.JPanel estpanel;
    private javax.swing.JLabel f;
    private javax.swing.JLabel g;
    private javax.swing.JLabel h;
    public static javax.swing.JTextArea info;
    private javax.swing.JPanel mainpanel;
    private javax.swing.JPanel ouestchessboardpanel;
    private javax.swing.JButton quit;
    private javax.swing.JLabel rg1;
    private javax.swing.JLabel rg2;
    private javax.swing.JLabel rg3;
    private javax.swing.JLabel rg4;
    private javax.swing.JLabel rg5;
    private javax.swing.JLabel rg6;
    private javax.swing.JLabel rg7;
    private javax.swing.JLabel rg8;
    public static javax.swing.JScrollPane scrollpanel;
    private javax.swing.JPanel sudchessboardpanel;
    // End of variables declaration//GEN-END:variables
}
